package com.briup.bookstore.service.impl;

import com.briup.bookstore.domain.po.CategoryPO;
import com.briup.bookstore.domain.vo.CategoryVO;
import com.briup.bookstore.mapper.CategoryMapper;
import com.briup.bookstore.service.CategoryService;
import com.briup.bookstore.utils.BeanUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class CategoryServiceImpl implements CategoryService {

    private final CategoryMapper mapper;

    @Override
    public List<CategoryVO> listWithChildren() {
        List<CategoryPO> poList = mapper.findAllWithChildren();
        return BeanUtil.convertList(poList, CategoryVO.class);
    }
}
